package com.cykj.service.serviceImp;

import com.cykj.bean.TbUser;
import com.cykj.mapper.UserMapper;
import com.cykj.service.UserService;
import com.cykj.utils.Base64Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Base64;

@Service
public class UserServiceImp implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public TbUser login(String acc, String pwd) {
        pwd = Base64Utils.encode(pwd);
        return userMapper.login(acc, pwd);
    }

    @Override
    public TbUser selectbyAcc(String acc) {
        return userMapper.selectbyAcc(acc);
    }

    @Override
    public int reg(String acc, String pwd, String name) {
        pwd = Base64Utils.encode(pwd);
        return userMapper.reg(acc,pwd,name);
    }
}
